<?php
	// Start the session
	session_start();
	
	//if we tell site to logout, destroy our session
	if(isset($_GET["logout"])) {
		if(($_GET["logout"] === "true") || ($_GET["logout"] === "loggedout")) {
			session_unset();
			session_destroy();
		}
	}else if(isset($_SESSION["username"])) {
		header("Location: home.php");
	}
	
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<!--<link rel="stylesheet" href="css/bootstrap.css">-->
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<div id="banner">
	<img src="images/banner.png" alt="">
	
	<div id="bannerMenu">
		<div id="bannerMenuLeft"></div>
		<div id="bannerMenuRight"></div>
	</div>
</div>


<div id="main">
	<p id="error">
	<?php 
		if(isset($_GET["error"])){
			if($_GET["error"] === "true") {
				echo "Du matade in fel användarnamn eller lösenord!";
			}else if($_GET["error"] === "loggedout") {
				echo "Du har blivit utloggad!";
			}
		}
	?> 
	</p>
	<div id="loginBox">
		<form id="loginForm" action="home.php" method="POST">
			<input class="inputLogin" id="user" type="text" placeholder="Användarnamn" autofocus name="user" maxlength="50">
			<input class="inputLogin" id="password" type="password" placeholder="Lösenord" name="password" maxlength="50">
		</form>
	
		<div id="login">
			<div class="fat">Logga in</div>
			<img src="https://yh.jenseneducation.se/img/rightarrowblack.png" alt="">
		</div>
	
		<p>Glömt lösenord?</p>
		<p>Ny användare?</p>
	
		<p class="fat">Om kakor</p>
	</div>
</div>

<script src="script/login.js"></script

</body>
</html>